/**
 * 
 */
package net.homelinux.ajay.net.ondisk.view.dialogs.client;

import com.google.gwt.user.client.Window;

import net.homelinux.ajay.net.ondisk.view.client.FolderTreeItem;

/**
 * @author ajay
 *
 */
public class AddFolderDialog extends AddNodeDlg {

//  private static AddFolderNode instance = new AddFolderNode();
  public static AddFolderDialog makeDialog(){
    return new AddFolderDialog();
  }


  private FolderTreeItem parent;

  
  /**
   *                                  
   */
  public AddFolderDialog() {
  }

  /* (non-Javadoc)
   * @see net.homelinux.ajay.net.ondisk.view.dialogs.client.AddNode#getNodeTypeString()
   */
  protected String getNodeTypeString() {
    return "Folder";
  }


  public void show(FolderTreeItem parent) {
    this.parent = parent;
    show();
  }
  
  public void onOk(){
    String newFolder = getValue();
    if(!parent.addFolder(newFolder)){
      Window.alert("A folder already exists with the name: "+newFolder );
    }
    super.onOk();
  }
  
  
  

}
